package model.actions;

import metier.GameState;
import metier.Objet;

public class MoveAction extends Action {

	/**
	 * 
	 */
	private static final long serialVersionUID = -7887929493076589208L;
	protected Integer column;
	protected Integer row;
	
	public MoveAction() {
		super();
	}
	
	public MoveAction(Integer column, Integer row) {
		super();
		this.column = column;
		this.row = row;
	}

	public Integer getColumn() {
		return column;
	}

	public void setColumn(Integer column) {
		this.column = column;
	}

	public Integer getRow() {
		return row;
	}

	public void setRow(Integer row) {
		this.row = row;
	}
	
	@Override
	public void commit(GameState state, Objet sender) {
		if(column != null) {
			sender.getPosition().setColumn(column);
		}
		if(row != null) {
			sender.getPosition().setRow(row);
		}
	}

}
